<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>具名插槽</title>
    <script src="lib/react/react.development.js"></script>
    <script src="lib/react/react-dom.development.js"></script>
    <script src="lib/babel.min.js"></script>
  </head>
  <body>
    <div id="root"></div>
    <script type="text/babel">
      function SplitPane(props) {
        return (
          <div className="SplitPane">
            <div className="SplitPane-left">{props.left}</div>
            <div className="SplitPane-right">{props.right}</div>
          </div>
        );
      }

      class Left extends React.Component {
        render() {
          return <div>这是左侧部分</div>;
        }
      }
      class Right extends React.Component {
        render() {
          return <div>这是右侧部分</div>;
        }
      }

      function App() {
        return <SplitPane left={<Left />} right={<Right />} />;
      }
      // 通过调用React自身方法render可以得到当前组件的实例对象,并渲染到页面容器.
      ReactDOM.render(<App />, document.getElementById("root"));
    </script>
  </body>
</html>
